home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / gauge / carvb25 / cexample.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-01-15  |  12.6 KB  |  437 lines

  1. VERSION 2.00
  2. Begin Form Examples 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Examples"
  6.    ClientHeight    =   5370
  7.    ClientLeft      =   1380
  8.    ClientTop       =   1380
  9.    ClientWidth     =   8745
  10.    Height          =   5775
  11.    Left            =   1320
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MDIChild        =   -1  'True
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   358
  17.    ScaleMode       =   3  'Pixel
  18.    ScaleWidth      =   583
  19.    Top             =   1035
  20.    Width           =   8865
  21.    Begin CommandButton Command1 
  22.       Caption         =   "Start"
  23.       Height          =   372
  24.       Left            =   3480
  25.       TabIndex        =   6
  26.       Top             =   4920
  27.       Width           =   1812
  28.    End
  29.    Begin Timer Timer6 
  30.       Enabled         =   0   'False
  31.       Interval        =   100
  32.       Left            =   480
  33.       Top             =   4920
  34.    End
  35.    Begin Timer Timer5 
  36.       Enabled         =   0   'False
  37.       Interval        =   1000
  38.       Left            =   120
  39.       Top             =   4920
  40.    End
  41.    Begin CAR Car1 
  42.       AutoRedraw      =   -1  'True
  43.       BackgroundColor =   &H00000000&
  44.       BackgroundPicture=   CEXAMPLE.FRX:0000
  45.       BevelInner      =   1  ' 1 - Raised
  46.       BevelOuter      =   2  ' 2 - Inset
  47.       BevelWidth      =   2
  48.       BorderType      =   1  ' 1 - Bevel
  49.       BorderWidth     =   2
  50.       CaptionColor    =   &H0000FFFF&
  51.       Danger          =   6
  52.       Delta           =   1
  53.       FrameColor      =   &H00000000&
  54.       FrameScaleX     =   0
  55.       FrameScaleY     =   0
  56.       FrameStyle      =   0  ' 0 - None
  57.       GaugeType       =   5  ' 5 - Volts
  58.       Height          =   2292
  59.       HubColor        =   &H00808080&
  60.       HubScale        =   0.15
  61.       Index           =   5
  62.       Left            =   5880
  63.       Max             =   10
  64.       Min             =   0
  65.       MouseControl    =   0   'False
  66.       NeedleColor     =   &H00FF0000&
  67.       OutlineAlign    =   0  ' 0 - Left 
  68.       OutlineColor    =   &H00000000&
  69.       OutlineTitle    =   ""
  70.       OutlineWidth    =   0
  71.       ShowDanger      =   -1  'True
  72.       ShowWarning     =   -1  'True
  73.       TabIndex        =   5
  74.       TicColor        =   &H00FFFFFF&
  75.       Top             =   2520
  76.       Value           =   0
  77.       Warning         =   5
  78.       Width           =   2772
  79.    End
  80.    Begin CAR Car1 
  81.       AutoRedraw      =   -1  'True
  82.       BackgroundColor =   &H00000000&
  83.       BackgroundPicture=   CEXAMPLE.FRX:58DA
  84.       BevelInner      =   1  ' 1 - Raised
  85.       BevelOuter      =   2  ' 2 - Inset
  86.       BevelWidth      =   2
  87.       BorderType      =   1  ' 1 - Bevel
  88.       BorderWidth     =   2
  89.       CaptionColor    =   &H0000FFFF&
  90.       Danger          =   6
  91.       Delta           =   1
  92.       FontBold        =   -1  'True
  93.       FontItalic      =   0   'False
  94.       FontName        =   "Arial"
  95.       FontSize        =   6.75
  96.       FontStrikethru  =   0   'False
  97.       FontUnderline   =   0   'False
  98.       FrameColor      =   &H00000000&
  99.       FrameScaleX     =   0
  100.       FrameScaleY     =   0
  101.       FrameStyle      =   0  ' 0 - None
  102.       GaugeType       =   4  ' 4 - Water Temp
  103.       Height          =   2292
  104.       HubColor        =   &H00808080&
  105.       HubScale        =   0.15
  106.       Index           =   4
  107.       Left            =   3000
  108.       Max             =   10
  109.       Min             =   0
  110.       MouseControl    =   0   'False
  111.       NeedleColor     =   &H00FF0000&
  112.       OutlineAlign    =   0  ' 0 - Left 
  113.       OutlineColor    =   &H00000000&
  114.       OutlineTitle    =   ""
  115.       OutlineWidth    =   0
  116.       ShowDanger      =   -1  'True
  117.       ShowWarning     =   -1  'True
  118.       TabIndex        =   4
  119.       TicColor        =   &H00FFFFFF&
  120.       Top             =   2520
  121.       Value           =   0
  122.       Warning         =   5
  123.       Width           =   2772
  124.    End
  125.    Begin CAR Car1 
  126.       AutoRedraw      =   -1  'True
  127.       BackgroundColor =   &H00000000&
  128.       BackgroundPicture=   CEXAMPLE.FRX:AFF4
  129.       BevelInner      =   1  ' 1 - Raised
  130.       BevelOuter      =   2  ' 2 - Inset
  131.       BevelWidth      =   2
  132.       BorderType      =   1  ' 1 - Bevel
  133.       BorderWidth     =   2
  134.       CaptionColor    =   &H0000FFFF&
  135.       Danger          =   6
  136.       Delta           =   1
  137.       FontBold        =   -1  'True
  138.       FontItalic      =   0   'False
  139.       FontName        =   "Arial"
  140.       FontSize        =   6.75
  141.       FontStrikethru  =   0   'False
  142.       FontUnderline   =   0   'False
  143.       FrameColor      =   &H00000000&
  144.       FrameScaleX     =   0
  145.       FrameScaleY     =   0
  146.       FrameStyle      =   0  ' 0 - None
  147.       GaugeType       =   3  ' 3 - Oil Pressure
  148.       Height          =   2292
  149.       HubColor        =   &H00808080&
  150.       HubScale        =   0.15
  151.       Index           =   3
  152.       Left            =   120
  153.       Max             =   10
  154.       Min             =   0
  155.       MouseControl    =   0   'False
  156.       NeedleColor     =   &H00FF0000&
  157.       OutlineAlign    =   0  ' 0 - Left 
  158.       OutlineColor    =   &H00000000&
  159.       OutlineTitle    =   ""
  160.       OutlineWidth    =   0
  161.       ShowDanger      =   -1  'True
  162.       ShowWarning     =   -1  'True
  163.       TabIndex        =   3
  164.       TicColor        =   &H00FFFFFF&
  165.       Top             =   2520
  166.       Value           =   0
  167.       Warning         =   5
  168.       Width           =   2772
  169.    End
  170.    Begin CAR Car1 
  171.       AutoRedraw      =   -1  'True
  172.       BackgroundColor =   &H00000000&
  173.       BackgroundPicture=   CEXAMPLE.FRX:103F6
  174.       BevelInner      =   1  ' 1 - Raised
  175.       BevelOuter      =   2  ' 2 - Inset
  176.       BevelWidth      =   2
  177.       BorderType      =   1  ' 1 - Bevel
  178.       BorderWidth     =   2
  179.       CaptionColor    =   &H0000FFFF&
  180.       Danger          =   6
  181.       Delta           =   1
  182.       FrameColor      =   &H00000000&
  183.       FrameScaleX     =   0
  184.       FrameScaleY     =   0
  185.       FrameStyle      =   0  ' 0 - None
  186.       GaugeType       =   2  ' 2 - Fuel
  187.       Height          =   2292
  188.       HubColor        =   &H00808080&
  189.       HubScale        =   0.15
  190.       Index           =   2
  191.       Left            =   5880
  192.       Max             =   10
  193.       Min             =   0
  194.       MouseControl    =   0   'False
  195.       NeedleColor     =   &H00FF0000&
  196.       OutlineAlign    =   0  ' 0 - Left 
  197.       OutlineColor    =   &H00000000&
  198.       OutlineTitle    =   ""
  199.       OutlineWidth    =   0
  200.       ShowDanger      =   -1  'True
  201.       ShowWarning     =   -1  'True
  202.       TabIndex        =   2
  203.       TicColor        =   &H00FFFFFF&
  204.       Top             =   120
  205.       Value           =   0
  206.       Warning         =   5
  207.       Width           =   2772
  208.    End
  209.    Begin CAR Car1 
  210.       AutoRedraw      =   -1  'True
  211.       BackgroundColor =   &H00000000&
  212.       BevelInner      =   1  ' 1 - Raised
  213.       BevelOuter      =   2  ' 2 - Inset
  214.       BevelWidth      =   2
  215.       BorderType      =   1  ' 1 - Bevel
  216.       BorderWidth     =   2
  217.       CaptionColor    =   &H0000FFFF&
  218.       Danger          =   6
  219.       Delta           =   1
  220.       FrameColor      =   &H00000000&
  221.       FrameScaleX     =   0
  222.       FrameScaleY     =   0
  223.       FrameStyle      =   0  ' 0 - None
  224.       GaugeType       =   1  ' 1 - Speedometer
  225.       Height          =   2292
  226.       HubColor        =   &H00808080&
  227.       HubScale        =   0.15
  228.       Index           =   1
  229.       Left            =   3000
  230.       Max             =   10
  231.       Min             =   0
  232.       MouseControl    =   0   'False
  233.       NeedleColor     =   &H00FF0000&
  234.       OutlineAlign    =   0  ' 0 - Left 
  235.       OutlineColor    =   &H00000000&
  236.       OutlineTitle    =   ""
  237.       OutlineWidth    =   0
  238.       ShowDanger      =   -1  'True
  239.       ShowWarning     =   -1  'True
  240.       TabIndex        =   1
  241.       TicColor        =   &H00FFFFFF&
  242.       Top             =   120
  243.       Value           =   0
  244.       Warning         =   5
  245.       Width           =   2772
  246.    End
  247.    Begin CAR Car1 
  248.       AutoRedraw      =   -1  'True
  249.       BackgroundColor =   &H00000000&
  250.       BevelInner      =   1  ' 1 - Raised
  251.       BevelOuter      =   2  ' 2 - Inset
  252.       BevelWidth      =   2
  253.       BorderType      =   1  ' 1 - Bevel
  254.       BorderWidth     =   2
  255.       CaptionColor    =   &H0000FFFF&
  256.       Danger          =   6
  257.       Delta           =   1
  258.       FrameColor      =   &H00000000&
  259.       FrameScaleX     =   0
  260.       FrameScaleY     =   0
  261.       FrameStyle      =   0  ' 0 - None
  262.       GaugeType       =   0  ' 0 - Tach
  263.       Height          =   2292
  264.       HubColor        =   &H00808080&
  265.       HubScale        =   0.15
  266.       Index           =   0
  267.       Left            =   120
  268.       Max             =   10
  269.       Min             =   0
  270.       MouseControl    =   0   'False
  271.       NeedleColor     =   &H00FF0000&
  272.       OutlineAlign    =   0  ' 0 - Left 
  273.       OutlineColor    =   &H00000000&
  274.       OutlineTitle    =   ""
  275.       OutlineWidth    =   0
  276.       ShowDanger      =   -1  'True
  277.       ShowWarning     =   -1  'True
  278.       TabIndex        =   0
  279.       TicColor        =   &H00FFFFFF&
  280.       Top             =   120
  281.       Value           =   0
  282.       Warning         =   5
  283.       Width           =   2772
  284.    End
  285.    Begin Timer Timer4 
  286.       Enabled         =   0   'False
  287.       Interval        =   1000
  288.       Left            =   6390
  289.       Top             =   7065
  290.    End
  291.    Begin Timer Timer3 
  292.       Enabled         =   0   'False
  293.       Interval        =   1000
  294.       Left            =   6360
  295.       Top             =   6630
  296.    End
  297.    Begin Timer Timer2 
  298.       Enabled         =   0   'False
  299.       Interval        =   200
  300.       Left            =   6360
  301.       Top             =   7500
  302.    End
  303.    Begin Timer Timer1 
  304.       Enabled         =   0   'False
  305.       Interval        =   1
  306.       Left            =   6360
  307.       Top             =   7950
  308.    End
  309.    Begin Label Label1 
  310.       Alignment       =   2  'Center
  311.       BackColor       =   &H00C0C0C0&
  312.       Caption         =   "Label1"
  313.       ForeColor       =   &H000000FF&
  314.       Height          =   372
  315.       Left            =   5760
  316.       TabIndex        =   7
  317.       Top             =   4920
  318.       Width           =   2772
  319.    End
  320. Dim gasv As Single
  321. Dim speedv As Single
  322. Dim tachv As Single
  323. Dim oilv As Single
  324. Dim tempv As Single
  325. Dim voltv As Single
  326. Dim gear As Integer
  327. Dim voltinc As Single
  328. Dim oilinc As Single
  329. Dim tachinc As Single
  330. Dim speedinc As Single
  331. Dim tempinc As Single
  332. Sub Command1_Click ()
  333.     Label1 = ""
  334.     Timer1.Enabled = True
  335.     Timer2.Enabled = True
  336.     Timer3.Enabled = True
  337.     Timer4.Enabled = True
  338.     Timer5.Enabled = True
  339.    ' Timer6.Enabled = True
  340. End Sub
  341. Sub Form_Load ()
  342.     init_values
  343.     Label1 = ""
  344. End Sub
  345. Sub Gauge3_Change ()
  346. End Sub
  347. Sub gauge7_change ()
  348. End Sub
  349. Sub Gauge7_Turn ()
  350. End Sub
  351. Sub init_values ()
  352.     speedv = 0#
  353.     tachv = 0#
  354.     oilv = 0#
  355.     gasv = 1#
  356.     tempv = 100#
  357.     voltv = 12
  358.     gear = 1
  359.     voltinc = .5
  360.     speedinc = 1
  361.     oilinc = 1
  362.     tachinc = .2
  363.     tempinc = 5
  364.     Car1(0) = 0
  365.     Car1(1) = 0
  366.     Car1(2) = 1
  367.     Car1(3) = 0
  368.     Car1(4) = 100
  369.     Car1(5) = 0
  370. End Sub
  371. Sub Timer1_Timer ()
  372.     Car1(0) = tachv
  373.     Car1(1) = speedv
  374.     Car1(3) = oilv
  375.     tachv = tachv + tachinc
  376.     speedv = speedv + speedinc
  377.     oilv = oilv + oilinc
  378.     If tachv > 7 And gear < 4 Then
  379.         tachv = 3
  380.         gear = gear + 1
  381.         gearlabel = Str(gear)
  382.     ElseIf tachv > 7 Then
  383.         tachv = 7
  384.     End If
  385.     If speedv > 130 Then
  386.         speedv = 130
  387.     End If
  388.     If oilv > 60 Then
  389.         oilv = 60
  390.     End If
  391. End Sub
  392. Sub Timer2_Timer ()
  393.     Car1(5) = voltv
  394.     voltv = voltv + voltinc
  395.     If voltv > 13.5 Then
  396.        voltinc = -.4
  397.     End If
  398.     If voltv < 10 Then
  399.         voltinc = .4
  400.     End If
  401. End Sub
  402. Sub Timer3_Timer ()
  403.     Car1(4) = tempv
  404.     tempv = tempv + tempinc
  405.     If tempv > 230 Then
  406.         tempinc = -1#
  407.     End If
  408.     If tempv > 200 And tempv < 230 Then
  409.         tempinc = 1#
  410.     End If
  411. End Sub
  412. Sub Timer4_Timer ()
  413.     Car1(3) = oilv
  414.     oilv = oilv + 2
  415. End Sub
  416. Sub Timer5_Timer ()
  417.     Car1(2) = gasv
  418.     gasv = gasv - .01
  419.     If gasv <= 0# Then
  420.         Label1 = "Out of GAS!"
  421.         Timer1.Enabled = False
  422.         Timer2.Enabled = False
  423.         Timer3.Enabled = False
  424.         Timer4.Enabled = False
  425.         Timer4.Enabled = False
  426.         Timer5.Enabled = False
  427.         init_values
  428.     End If
  429. End Sub
  430. Sub Timer6_Timer ()
  431.     Car1(1) = speedv
  432.     speedv = speedv + 2
  433.     If speedv > 130 Then
  434.         speedv = 130
  435.     End If
  436. End Sub
  437.